<%@page import="com.deloitte.util.StringUtilities"%>
<%@page import="com.deloitte.model.SlideInfo"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.deloitte.service.rest.jersy.SlideInfoService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>

<%
String catalogCode = request.getParameter("catalogcode");
ArrayList<SlideInfo> slides = SlideInfoService.getSlides(catalogCode);
%>

<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/slider.js"></script>
<%
	if(slides != null && !slides.isEmpty()){
	%>
<script type="text/javascript">
		$(document).ready(function(){	
			$("#slider").easySlider({
				firstShow:false,
				lastShow:false,
				firstText:'',
				lastText:'',
				numericprevnext:true,
				speed:1
			});
		});	
	</script>
<%
	}
	%>
<link href="css/screen.css" rel="stylesheet" type="text/css"
	media="screen" />

</head>
<body>

	<div id="slider">
		<ul>
			<%
			String slidePath = "";
			if(slides != null && !slides.isEmpty()){
				for(SlideInfo slide : slides)
				{
					if(slide != null && !StringUtilities.isEmpty(slide.getFilePath()) && !StringUtilities.isEmpty(slide.getRootPath()))
					{
						slidePath = "../UtilityDocuments/"+slide.getRootPath()+"/"+slide.getFilePath();
						if(slide.isFlagImage())
						{
							%>
								<li>
									<img src="<%=slidePath%>" alt="<%=slide.getFilePath()%>"  width="100%" height="100%" />
								</li>
							<%
						}
						else if(slide.isFlagVideo())
						{
							%>
							<li>
								<video  width="100%" height="100%" controls="controls">
									<source src="<%=slidePath%>" type="<%=slide.getContentType()%>"></source>
									Your browser does not support the video tag.
								</video>
							</li>
						<%
						}
					}
				}
			}
			else
			{
				%>
					<h1>No catalogs available</h1>
				<%
			}
			%>
		</ul>
	</div>

</body>
